package com.chlitina.store.modules.cash.model;

public class CarePayment {
	private AllCardPaymentDetail allCardPaymentDetail;
	private DurationCardPaymentDetail durattionCardPaymentDetail;
	private TimesCardPaymentDetail timesCardPaymentDetail;
	private float cash;
	private String description;

	public void updateDescription() {
		if (allCardPaymentDetail != null) {
			AllCardPayment cardPayment = allCardPaymentDetail.getCardPayment();
			description = "耗卡：【"
					+ allCardPaymentDetail.getCardPayment().getCard()
							.getTemplate().getName() + "】(综合卡"
					+ cardPayment.getCard().getCardNumber() + "), "
					+ allCardPaymentDetail.getRealCost() + " 元" + "----剩余-- "
					+ allCardPaymentDetail.getCardPayment().getCurrentMoney();
		} else if (getDurattionCardPaymentDetail() != null) {
			DurationCardPayment cardPayment = getDurattionCardPaymentDetail()
					.getCardPayment();
			description = "耗卡：【"
					+ cardPayment.getCard().getTemplate().getName()
					+ "】(时段卡"
					+ getDurattionCardPaymentDetail().getCardPayment().getCard()
							.getCardNumber()
					+ "), "
					+ getDurattionCardPaymentDetail().getRealCost()
					+ " 元"
					+ "----剩余-- "
					+ getDurattionCardPaymentDetail().getCardPayment()
							.getCurrentMoney();
		} else if (getTimesCardPaymentDetail() != null) {
			TimesCardPayment cardPayment = getTimesCardPaymentDetail()
					.getCardPayment();
			description = "耗卡：【"
					+ cardPayment.getCard().getTemplate().getName()
					+ "】(计次卡"
					+ getTimesCardPaymentDetail().getCardPayment().getCard()
							.getCardNumber() + "), "
					+ getTimesCardPaymentDetail().getRealCost() + " 元" + "----剩余-- "
					+ getTimesCardPaymentDetail().getCardPayment().getCurrentTimes() +" 次";
		} else if (cash > 0) {
			description = "现金：付现 " + cash + " 元";
		}
	}

	public float getRealTotalCost() {
		if (allCardPaymentDetail != null) {
			return allCardPaymentDetail.getRealCost();
		} else if (getDurattionCardPaymentDetail() != null) {
			return getDurattionCardPaymentDetail().getRealCost();
		} else if (getTimesCardPaymentDetail() != null) {
			return getTimesCardPaymentDetail().getRealCost();
		} else if (cash > 0) {
			return cash;
		}
		return 0F;
	}

	public float getCash() {
		return cash;
	}

	public void setCash(float cash) {
		this.cash = cash;
	}

	public AllCardPaymentDetail getAllCardPaymentDetail() {
		return allCardPaymentDetail;
	}

	public void setAllCardPaymentDetail(
			AllCardPaymentDetail allCardPaymentDetail) {
		this.allCardPaymentDetail = allCardPaymentDetail;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public DurationCardPaymentDetail getDurattionCardPaymentDetail() {
		return durattionCardPaymentDetail;
	}

	public void setDurattionCardPaymentDetail(DurationCardPaymentDetail durattionCardPaymentDetail) {
		this.durattionCardPaymentDetail = durattionCardPaymentDetail;
	}

	public TimesCardPaymentDetail getTimesCardPaymentDetail() {
		return timesCardPaymentDetail;
	}

	public void setTimesCardPaymentDetail(TimesCardPaymentDetail timesCardPaymentDetail) {
		this.timesCardPaymentDetail = timesCardPaymentDetail;
	}
}
